<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Winter.BackEnd.Models.Domain.IPerson>" %>

<%@ Import Namespace="Winter.BackEnd.Models.DataTypes" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Messages
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <ul class="message-menu floatLeft">
        <li>
            <input type="text" class="search-messages" /></li>
        <li class="recieved-messages selected-option">
            <%= Html.ActionLink("Messages", "GetRecievedMessages") %>
        </li>
        <li class="sent-messages">
            <%= Html.ActionLink("Sent", "GetSentMessages") %>
        </li>
    </ul>
    <div class="message-container floatLeft">
        <ul id="buttonWriteNewMessage" class="message-control">
            <li class="new-message">Write New Message</li>
            <li id="StatusMessage"></li>
        </ul>
        <div id="divNewMessage" style="display: none;">
            <p>
                Recipient name:</p>
            <p>
                <input type="hidden" id="hiddenRecipientID" />
                <input id="MessageRecipient" type="text" class="newMessageSubject" /></p>
            <p>
                Subject:</p>
            <p>
                <input id="MessageSubject" type="text" class="newMessageSubject" /></p>
            <p>
                Body:</p>
            <p>
                <textarea cols="15" rows="15" id="MessageBody" class="newMessageBody"></textarea></p>
            <div style="float: left;">
                <a class="button" id="buttonSend" href=""><span class="msg">Send message</span>
                </a>
            </div>
            <div style="float: left; padding-left: 20px;">
                <a class="button" id="buttonCancel" onclick="return false;" href=""><span class="cancel">
                    Cancel sending</span> </a>
            </div>
        </div>
        <table id="messages">
        </table>
    </div>

    <script src="<%= Url.Content("~/Scripts/MessagesControl.js") %>" type="text/javascript"></script>

    <script id="MessageTemplate" type="text/html">
        {#template MAIN}
            {#foreach $T.messages as message}
                <tr class="message">
                    <td class="message-checkbox">
                        <input type="checkbox" />
                    </td>
                    <td class="message-photo">
                        <img src="{$T.message.SenderPhoto}" alt="{$T.message.Sender}" width="80px"
                            height="100px" class="floatLeft" />
                    </td>
                    <td class="message-details">
                        <a class="sender" href="Person/UserInfo/{$T.message.SenderID}">{$T.message.Sender}</a>
                        <input type="hidden" id="SenderName" value="{$T.message.SenderName}"/>
                        <p class="time">
                            {$T.message.Time}
                        </p>
                    </td>
                    <td class="message-body" id="{$T.message.Id}">
                        <p class="message-subject">
                            {$T.message.Subject}
                        </p>
                        <p class= "message-text">
                        {$T.message.MessageBody}
                        </p>
                    </td>
                    <td class="message-actions">
                        <a class="reply" onclick="return false;" >Reply</span> 
                        <a id="aDeleteMessage{$T.message.Id}" class="delete" onclick="return false;" href="">
                            Delete
                        </a>
                    </td>
                </tr>
            {#/for}
        {#/template MAIN}
    </script>

</asp:Content>
